Skip to content

Conversation

@0xAlunara
Copy link
Collaborator

@0xAlunara 0xAlunara commented Nov 7, 2025

While working on manage soft liquidation, I kept running into confusing user specific loan logic because of Zustand stores.

This PR aims to move user loan detail fetching out of Zustand stores and into a TanStack query for mint markets. You'll find that this is basically the same as what JJ's done for lend markets in main\src\lend\entities\user-loan-details.ts.

The query itself is an exact copy of what was inside the store and apiCrvusd.ts. I did not intent to refactor this too much to minimize potential bugs. This includes silly usage of Promise.allSettled and fulfilledValue. The query itself also fetches a lot of data which ideally should be split up in smaller queries. That's outside of the scope of this PR.

Like has been said previously, there exists a query for lend markets already, but there's still old Zustand and apiLending.ts code that's practically a duplicate of whatever's in that query. This will have to be removed in another PR.

Note that this query is only about user information. General information about the loan itself still happens in the Zustand stores in the remaining fetchLoanDetails function. What has been removed from fetchLoanDetails, however, is that it would also fetch user info and a loanExists. This has been refactored out, such that fetchLoanDetails only returns pure loan information, and no additional user loan information.

@vercel
Copy link

vercel bot commented Nov 7, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
curve-dapp Ready Ready Preview Comment Nov 8, 2025 2:38pm
curve-dapp-storybook Ready Ready Preview Comment Nov 8, 2025 2:38pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants